<?php
/**
 * CreateTime: 2023/11/15 10:17
 * User:LinQ
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('department', function (Blueprint $table)  {
            // 数据库基本配置
            $table->engine = 'InnoDB';
            // 数据库字段
            $table->id('department_id')->comment("部门id");
            $table->integer('com_id')->nullable(false)->comment("所属公司id");
            $table->string('department_name',20)->nullable(false)->comment("部门名称");
            $table->integer("pid")->default(0)->comment("父级部门id");
            $table->string("quick_sub_department",500)->nullable(true)->comment("快速筛选下级部门预留字段");
            $table->integer('responsible_user_id')->nullable(false)->comment("部门负责人id");
            $table->integer('owner_id')->nullable(false)->comment("创建人id");
            $table->integer('status')->nullable(false)->default(2)->comment("状态 1正常 2已删除");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
};
